Repository navigation
ci: Migrate from eslint to oxlint - #3731
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
E2E Test Results✅ All tests passed • 469 passed • 1 skipped • 1201s
Tests ran across 4 shards in parallel. |
5e7f0db to
abd8de2
Compare
| COPY ./packages/common-utils/package.json ./packages/common-utils/package.json | ||
| COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/tsconfig.build.json ./packages/api/package.json ./packages/api/ | ||
| COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.mjs ./packages/app/mdx.d.ts ./packages/app/css.d.ts ./packages/app/eslint.config.mjs ./packages/app/ | ||
| COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.mjs ./packages/app/mdx.d.ts ./packages/app/css.d.ts ./packages/app/ |
There was a problem hiding this comment.
eslint didn't need to be in the Docker image anyway
| "lint": "node ../../scripts/ci/oxlint-warnings.mjs --max-warnings 302 && yarn run -T prettier --check --log-level warn 'src/**/*.ts' 'scripts/**/*.ts'", | ||
| "lint:fix": "yarn run -T oxlint --fix && yarn run -T prettier --write --log-level warn 'src/**/*.ts' 'scripts/**/*.ts'", |
There was a problem hiding this comment.
Prettier used to run as a part of eslint, now it runs standalone, after oxlint
| })); | ||
|
|
||
| jest.mock('@/components/SearchInput/SearchWhereInput', () => { | ||
| const React = jest.requireActual('react'); |
There was a problem hiding this comment.
Unused, which was missed by eslint because it doesn't flag React as unused when react plugins are installed
| const [numberFormat, setNumberFormat] = React.useState< | ||
| NumberFormat | undefined | ||
| >(undefined); | ||
| // eslint-disable-next-line react-hooks/globals |
There was a problem hiding this comment.
Due to a difference in scoping checks in the globals rule in oxlint
| }) { | ||
| const start = new Date(history.createdAt.toString()); | ||
|
|
||
| // eslint-disable-next-line no-restricted-syntax |
There was a problem hiding this comment.
The purity rule replaces our custom Date check, with fewer false positives
| const hasSpanEvents = useMemo(() => { | ||
| return ( | ||
| Array.isArray(firstRow?.__hdx_span_events) && | ||
| firstRow?.__hdx_span_events.length > 0 |
There was a problem hiding this comment.
__hdx_span_events is typed as any. Differences in oxlint's memoization check required this change or ignoring a memoization warning
There was a problem hiding this comment.
prettier used to use eslint's ignore rules, now it needs its own.
| "jsxBracketSameLine": false, | ||
| "fluid": false, |
There was a problem hiding this comment.
Invalid / deprecated options that were previously ignored now throw because we call prettier directly
| spanLinkFrameRowIdsRef.current.has(activeRowId) && | ||
| resolvedFrameLabels[activeRowId] !== mainContent | ||
| ) { | ||
| // eslint-disable-next-line react-hooks/set-state-in-effect |
There was a problem hiding this comment.
oxlint doesn't flag this when the write is guarded by a ref (spanLinkFrameRowIdsRef.current in this case)
abd8de2 to
33500e9
Compare
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (6 lines, under the 30-line bar for Tier 4), 3 file(s) in private internal-tooling packages, excluded from the line count Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 1 unchanged from an earlier push (already inline above). 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a well-executed ESLint→oxlint tooling migration: configs, CI wrapper scripts, workflow, and mechanical 🟡 P2 — recommended
🟡 P2 — testing
🔵 P3 nitpicks (4)
Reviewers (10 dispatched): correctness, adversarial, reliability, testing, maintainability, project-standards, kieran-typescript, previous-comments, agent-native, learnings-researcher. Coverage note: The previous-comments reviewer confirmed all prior actionable feedback was addressed (bootstrap rule removed; remaining prior comments are bot output or author explanations). Findings above reflect direct diff analysis of the CI wrapper scripts, oxlint configs, and source edits; the broader reviewer fan-out was still completing at synthesis time, so treat the P2/P3 set as the confirmed-actionable core rather than an exhaustive list. Testing gaps: No regression test pins the intended CI exit behavior after the No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
brandon-pereira
left a comment
There was a problem hiding this comment.
Works great! Good idea!
| ); | ||
| const warnings = collectWarnings(results); | ||
| const hasErrors = results.some(r => r.errorCount > 0) || status === 2; | ||
| const hasErrors = results.some(r => r.errorCount > 0); |
There was a problem hiding this comment.
🟡 P2 — Lint wrapper ignores oxlint's exit status, so a fatal oxlint failure that still prints JSON passes CI
Use const { status, results } = runOxlint(...) and set hasErrors = results.some(r => r.errorCount > 0) || (status !== 0 && status !== 1), or otherwise treat any non-zero status not explained by the diagnostics as a failure. The deleted eslint-warnings.mjs did this with || status === 2. Here runOxlint returns status, but main() throws it away and decides only from the parsed diagnostics. Example: tsgolint or a JS plugin fails to load, oxlint writes the error to stderr and exits non-zero, and stdout still holds valid JSON with few or no diagnostics. The package lint script then exits 0. Add a test that pins this case.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| "react/purity": "error", | ||
| "react/set-state-in-render": "error", | ||
| "react/unsupported-syntax": "warn", | ||
| "eslint-js/no-restricted-syntax": [ |
There was a problem hiding this comment.
🟡 P2 — Swapping the Date.now()/new Date() syntax rule for react/purity loses checks in helpers called during render
react/purity only looks at code inside a component or hook body. The old no-restricted-syntax date selectors flagged every non-test file. Example: metricNamesQueryArgs in packages/app/src/hooks/useMetricNames.ts calls new Date() and runs inside useMemo during render. It needed a disable before; this PR removes that disable, and nothing would flag the same pattern in new code. Either keep the two DATE_SYNTAX_RESTRICTIONS selectors in eslint-js/no-restricted-syntax, with the existing test/e2e overrides, or say plainly in the PR and docs that only direct calls in the render body are checked now.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
0da8160 to
430f849
Compare
Summary
This PR migrates the repo from eslint to oxlint.
Why? Faster lints that use less memory! And one less tool that is dependent on the typescript JS API, which will make migrating the typescript 7 slightly easier down the line.
Editor setup: developers need the oxc VS Code extension instead of the ESLint one.
How much faster?
These times represent time to lint and format, since eslint and prettier execute together on
main:Changes vs ESLint
Most of the eslint rules we were running before have direct equivalents in oxlint or are run as eslint plugins with oxlint's eslint plugin support. A few items change:
@eslint-react/no-leaked-conditional-renderingis no longer checkednew DateandDate.nowin hooks and components, which allows us to remove our custom no-date rule and get rid ofeslintand someeslint-plugin-*packages remain as dependencies because the JS plugins need them. The repo uses fewer ESLint packages but still has some.How to reproduce
Run the lint (skip cache for a fair duration):
References